// 移动零
#include<iostream>
#include<vector>

using namespace std;

class Solution{
public:
    void moveZeros(vector<int>& nums){
        int idx = 0;
        for(int i = 0; i < nums.size(); i++){
            if (nums[i] != 0 ){
                nums[idx] = nums[i];
                idx ++ ;
            }
        }
        for(int i = idx; i < nums.size(); i++){
            nums[i] = 0;
        }
    }

};

void Print(vector<int>& nums){
    for(const int a : nums){
        cout << a << " ";
    }
    cout << endl;
}


int main(){

    vector<int> nums = {0,0,0,3,12,0};

    Solution solution;
    solution.moveZeros(nums);

    Print(nums);
    return 0;
}
